package client;

import java.util.logging.Level;
import java.util.logging.Logger;
import server.ManagerInf;

/**
 *
 * @author Java
 */
public class ClientThread extends Thread {

    PlayerMapPanel panel;
    public int playerNum;
    public ManagerInf m;
    
    public ClientThread(PlayerMapPanel panel,int playerNum,ManagerInf m) {
        this.panel = panel;
        this.playerNum = playerNum;
        this.m = m;
    }
    
    public void run() {

        try {

            while (true) {
                int [][] array = m.getMapArray(playerNum, 0);
                    for (int i = 0; i < 10; i++) {
                        for (int j = 0; j < 10; j++) {
                            ((javax.swing.JToggleButton) panel.getComponents()[i + j * 10]).setText(array[i][j] == 1 ? " " : (array[i][j] == 2?"H":(array[i][j] == 3?"M":" "))); // M = Miss H = Hit C = HAVE E = Empty 
                        }
                    }
                    Thread.sleep(1000);
            }
        }
        catch  (Exception e) {

        }
    }
}
